﻿function uploadProgress() {
    var elemBar = document.getElementById("barCell");
    var elemPercent = document.getElementById("percentCell");
    var uploadid = document.getElementById("DiskFileUpload_GUID").value;

    alert(uploadid);
    var timerid = window.setInterval(
        function () {
            var xhr;
            if (window.ActiveXObject)
                xhr = new ActiveXObject("Microsoft.XMLHTTP");
            else
                xhr = new XMLHttpRequest();

            xhr.open("get", "progress.ashx?DiskFileUpload_GUID=" + uploadid, false);
            xhr.send(null);

            if (xhr.readyState == 4) {
                if (xhr.status == 200) {
                    var result = eval("(" + xhr.responseText + ")");
                    elemBar.style.width = result.percent + "%";
                    elemPercent.innerHTML = result.percent + "%"
                }
            }
        }
        , 1000
        );
}